package hyrpt

class FinishedProcessController {
    def dynamicQueryService
    def finishedProcess() {
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def tableHeadList = []
        def finishedProcess = []
        def pageSizeList = [10, 20, 50, 100]
        def totalCount = 0
        params.SYS_QUERY_NAME = 'stepStatusAnalysisStepList'
        def stepStatusAnalysisStepList = dynamicQueryService.queryForList(params)
        if (params.EXPORT_CONTENT_NAME == 'Excel') {
            params.SYS_QUERY_NAME = 'finishedProcess'
            finishedProcess = dynamicQueryService.queryForList(params)
            if (finishedProcess.size() > 0) {
                tableHeadList = finishedProcess[0].keySet()
            }


        }
        print(tableHeadList)
        [startno                   : params.startno ?: '',
         endno                     : params.endno ?: '',
         pageSize                  : pageSize,
         totalCount                : totalCount,
         pageSizeList              : pageSizeList,
         tableHeadList             : tableHeadList,
         finishedProcess           : finishedProcess,
         lotId                     : params.lotId ?: '',
         startTime                 : params.startTime ?: '',
         endTime                   : params.endTime ?: '',
         step                      : params.step?:'',
         partName                  : params.partName ?: '',
         partDesc                  : params.partDesc ?: '',
         customer                  : params.customer ?: '',
         stepName                  : params.stepName ?: '',
         stepStatusAnalysisStepList: stepStatusAnalysisStepList
        ]
    }
}
